clear all
set more off
capture log close
log using "$output/figureA1.log", replace

version 16	

use "$data/ctcbyincome.dta", clear

sort year depx refundctc

twoway line refundctc year if depx==1 & earnings==10000, pstyle(p1) lp(-) || line refundctc year if depx==2 & earnings==10000, pstyle(p2) lp(_) || line refundctc year if depx==3 & earnings==10000, pstyle(p3) graphregion(color(white)) bgcolor(white) leg(order(1 "1 Kid" 2 "2 Kids" 3 "3 Kids") c(1) pos(10) ring(0)) ytitle("Refundable CTC Benefits") xtitle("Year") ylabel(3000(3000)9000) text(7500 2013 "Earnings = $10,000" , j(left) size(medsmall))
graph save "$output/ctc10k2.gph", replace

twoway line refundctc year if depx==1 & earnings==20000, pstyle(p1) lp(-) || line refundctc year if depx==2 & earnings==20000, pstyle(p2) lp(_) || line refundctc year if depx==3 & earnings==20000, pstyle(p3) graphregion(color(white)) bgcolor(white) leg(order(1 "1 Kid" 2 "2 Kids" 3 "3 Kids") c(1) pos(10) ring(0)) ytitle("Refundable CTC Benefits") xtitle("Year") ylabel(3000(3000)9000) text(7500 2013 "Earnings = $20,000" , j(left) size(medsmall))
graph save "$output/ctc20k2.gph", replace

twoway line refundctc year if depx==1 & earnings==30000, pstyle(p1) lp(-) || line refundctc year if depx==2 & earnings==30000, pstyle(p2) lp(_) || line refundctc year if depx==3 & earnings==30000, pstyle(p3) graphregion(color(white)) bgcolor(white) leg(order(1 "1 Kid" 2 "2 Kids" 3 "3 Kids") c(1) pos(10) ring(0)) ytitle("Refundable CTC Benefits") xtitle("Year") ylabel(3000(3000)9000) text(7500 2013 "Earnings = $30,000" , j(left) size(medsmall))
graph save "$output/ctc30k2.gph", replace

twoway line refundctc year if depx==1 & earnings==50000, pstyle(p1) lp(-) || line refundctc year if depx==2 & earnings==50000, pstyle(p2) lp(_) || line refundctc year if depx==3 & earnings==50000, pstyle(p3) graphregion(color(white)) bgcolor(white) leg(order(1 "1 Kid" 2 "2 Kids" 3 "3 Kids") c(1) pos(10) ring(0)) ytitle("Refundable CTC Benefits") xtitle("Year") ylabel(3000(3000)9000) text(7500 2013 "Earnings = $50,000" , j(left) size(medsmall))
graph save "$output/ctc50k2.gph", replace

graph combine "$output/ctc10k2.gph" "$output/ctc20k2.gph" "$output/ctc30k2.gph"  "$output/ctc50k2.gph" ,graphregion(color(white)) 
graph export "$output/figureA1.png", replace

erase "$output/ctc10k2.gph" 
erase "$output/ctc20k2.gph" 
erase "$output/ctc30k2.gph"  
erase "$output/ctc50k2.gph"

log close